package com.nj.api.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nj.api.entity.BidInfo;
import com.nj.api.entity.BidInfoForUser;
import com.nj.api.entity.RecordOfProd;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface BidInfoMapper extends BaseMapper<BidInfo> {

    @Select("SELECT u.phone,i.bid_money,i.bid_time FROM b_bid_info i JOIN u_user u ON i.uid = u.id WHERE i.prod_id=#{id} ORDER BY i.bid_time")
    List<RecordOfProd> getRecords(Long id);
    @Select("select p.product_name,b.bid_money,b.bid_time from" +
            " b_product_info p join b_bid_info b on p.id = b.prod_id " +
            "where b.uid=#{id} order by b.bid_time limit 6")
    List<BidInfoForUser> getByUserId(Integer id);
}
